#pragma once
#include "BaseProtocol.h"

enum GSBS_Msg_Id
{
   Msg_GB_GameHistory_Info = Msg_Base_GS_BS + 1,
};

enum  LookonType
{
	Lookon_MsgType_Browser,
    Lookon_MsgType_Black,
	Lookon_MsgType_Spectator,
	Lookon_MsgType_Observer,
};

class GameMsg : public Msg
{
public:
	GameMsg()
	{
        m_dwMsgId = 0;
		m_nLength = 0;
		m_pszBuffer = NULL;
	}

	~GameMsg()
	{
		SAFE_DELETE(m_pszBuffer);
	}
	virtual DWORD GetMsgId() {return m_dwMsgId;};
	virtual DWORD GetLength() {return m_nLength;};
	virtual BOOL Read(CSocketStream& iStream);
	virtual BOOL Write(CSocketStream& oStream) const;
public:
	DWORD m_dwMsgId;
	int m_nLength;
	char *m_pszBuffer;
};

class GameHistoryMsg : public Msg
{
public:
	GameHistoryMsg()
	{
		m_dwProductId = 0;
		m_dwMatchId = 0;
		m_dwStageId = 0;
		m_dwTableId = 0;
		m_dwUserId = 0;
		m_dwLookonType = 0;
	};

	~GameHistoryMsg( )
	{
	};

	virtual DWORD GetMsgId() {return Msg_GB_GameHistory_Info;};
	virtual DWORD GetLength() 
	{
		int nLen = sizeof(m_dwProductId) + sizeof(m_dwMatchId) + sizeof(m_dwStageId) + sizeof(m_dwTableId) + sizeof(m_dwUserId) + sizeof(m_dwLookonType);
		    nLen += m_GameMsg.GetLength();
        return nLen;
	};
	virtual BOOL Read(CSocketStream& iStream);
	virtual BOOL Write(CSocketStream& oStream) const ;

	BOOL FillHistoryMsg(Msg *pMsg);
public:
	DWORD m_dwProductId;
	DWORD m_dwMatchId;
	DWORD m_dwStageId;
	DWORD m_dwTableId;
	DWORD m_dwUserId;
	DWORD m_dwLookonType;
	GameMsg m_GameMsg;
};

